import { Injectable } from '@angular/core';
import { StateMachineService } from "@farris/command-services";
import { FrameContext } from '@farris/devkit';
import { BefRepository, ResponseInfo } from '@farris/bef';
import { FormMessageService, FormNotifyService, CommandService, FormLoadingService, BeActionService } from '@farris/command-services';
import { EMPTY, of } from 'rxjs';
import { tap, map, switchMap } from 'rxjs/operators';

@Injectable()
export class GhlydxzFrmControllerService {
  // ghlydxz-l10i-component_ghlydxz_root-component
  // ghlydxz-l10i-component_ghlydxz_left-data-grid-component
  // ghlydxz-l10i-component_ghlydxz_right-data-grid-component
  private frameCode = "l10i";
  private frameId = "ghlydxz-" + this.frameCode + "-component_ghlydxz_root-component";

  constructor(
    private frameContext: FrameContext,
    private messageService: FormMessageService,
    private beActionService: BeActionService,
    public stateMachineService: StateMachineService,
    public formNotifyService: FormNotifyService,
    private commandService: CommandService,
    public loadingService: FormLoadingService
  ) { }

  /**
   * 确认点击事件
   * @remarks 
   * @returns 
   */
  confirm(): any {
    console.log('viewInitEvent:', this.frameContext.appContext.frameContextManager);
    debugger
    const leftcheckeds = this.frameContext.appContext.componentManager.get(['ghlydxz-3o1k-component_ghlydxz_left-data-grid-component', 'left-data-grid']).checkeds;
    this.frameContext.uiState.setPropertyValue('datas', "");
     let datas: Object[] = [];
     for (let item of leftcheckeds) {
        datas.push(item);
     }
     this.frameContext.uiState.setPropertyValue('datas', datas);
  }
}
